
<?php echo $this->Form->create('ExtraPayment'); ?>
<table>

  <h2><?php echo __('Gastos Extras'); ?></h2>

  <tr>
    <td>Descripcion</td>
    <td> <?php echo $this->Form->input('description', array('label' => false)); ?> </td>
  </tr>
  <tr>
    <td>Total ($)</td>
    <td> <?php echo $this->Form->input('total', array('label' => false)); ?> </td>
  </tr>
</table>

<?php echo $this->Form->end(); ?>

<div style="text-align: center">
  <?php echo $this->form->button(__('Guardar'), array('id' => 'saveExtra', 'class' => 'imprimir')); ?>
  <?php echo $this->form->button(__('Cancelar'), array('id' => 'popupContactClose', 'class' => 'imprimir')); ?>
</div>


<script>

  $(document).ready(function(){
    $("#ExtraPaymentTotal").numeric();
    $("#ExtraPaymentDescription").focus();
    
    $('#saveExtra').click(function() {

      var description = $("#ExtraPaymentDescription").val();
      var total = $("#ExtraPaymentTotal").val();
      var cash_dailies_id = parseInt($("#cashId").text());
      var date = $.now();

      
    
      $.post("<? echo $this->Html->url('../ExtraPayments/addAjax') ?>", 
      { description:description, total:total, cash_dailies_id:cash_dailies_id, date:date } ).done(function() { 
        $dialogExtra.dialog('open');

      })
      .fail(function() { 
        $errorExtra.dialog('open');
      });
         
     

    });
        
  });
  
</script>